
use "$root/data/interim/adminassistants_bg.dta", replace

drop if substr(soc,1,2)=="43"

gen numads=1

rename issoftware count_issoftware

collapse (sum) any_tech count_tech any_issoftware count_issoftware numads, by( year czone)

fillin year czone
drop if czone==.|year==.

egen sum_numads=sum(numads), by (year )

foreach var in any_tech count_tech any_issoftware count_issoftware{
	replace `var'=0 if `var'==.
	gen mean_`var'=`var'/numads
	egen sum_`var'=sum(`var'), by (year )
	gen mean_`var'_oth_czs=(sum_`var'-`var')/(sum_numads-numads)
}

keep year czone numads mean_any_tech mean_any_tech_oth_czs mean_count_tech mean_count_tech_oth_czs mean_any_issoftware mean_any_issoftware_oth_czs mean_count_issoftware mean_count_issoftware_oth_czs
order year czone numads mean_any_tech mean_any_tech_oth_czs mean_count_tech mean_count_tech_oth_czs mean_any_issoftware mean_any_issoftware_oth_czs mean_count_issoftware mean_count_issoftware_oth_czs
compress
save "$root/data/interim/mean_tech_by_cz_non_oas.dta",replace
